import time

from appium.webdriver.common.appiumby import By

from tools import app_driver


def app_index(driver):
    time.sleep(3)
    # 滑动三次
    for i in range(3):
        driver.swipe(start_x=1000, start_y=1000, end_x=80, end_y=1000)
    time.sleep(3)

def search_index(driver, search_text):
    # 点击首页,返回首页
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/home_ll").click()
    # 点击输入框
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/default_search_et").click()
    # 输入内容
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/search_et").send_keys(search_text)
    # 点击搜索按钮
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/search_btn").click()


if __name__ == '__main__':
    driver = app_driver()
    app_index(driver)